<!doctype html>
<html class="no-js">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <!-- <meta name="viewport" content="width=device-width, initial-scale=0">
    <meta name="viewport" content="width=drvice-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;"> -->
    <meta name="viewport" content="width=device-width,user-scalable=no, initial-scale=1">
    <title>头像</title>

    <link rel="icon" type="image/png" href="../qgj_qt/images/favicon.png">
    <link rel="stylesheet" href="css/amazeui.min.css">
    <link rel="stylesheet" href="css/swiper.min.css">
    <link rel="stylesheet" href="css/app.css">
    <link rel="stylesheet" href="/layui/css/layui.css" media="all">
    <!-- jquery -->
    <script src="/jquery/jquery.js"></script>
    <script src="/layui/layui.js"></script>

</head>

<body>

<!-- 外框 -->
<div id="waik">
    <!-- 头部 -->
    <div id="top" style="background:#01AFF0;" class="ziye_top">
        <div class="sos_t sos_t_zy ">
            <div class="fanh_shang fanh_yems">
                <a href="index_content" onclick="history.back();"><img src="images/return1.png" style="width:10px;"></a>
            </div>
            <div class="text">更换头像</div>
            <div class="right">
                <div class="zd"><a href="#">&nbsp;</a></div>
            </div>
        </div>
    </div>
    <!-- 内容 -->
    <br>
    <br>
    <form method="post" action="" enctype="multipart/form-data" id="form">
        @csrf
        <div class="list_index_my" style=" margin-top:1px;">
            <div class="my_dind">
                <div class="bt">
                    <div class="layui-upload">
                        <button type="button" class="layui-btn layui-btn-normal" id="test"><i class="layui-icon"></i>上传头像</button>
                        <div class="layui-upload-list">
                            <img src="{{$row->img}}" class="layui-upload-img" id="img" name="img" style="width: 100px; height: 100px;">
                        </div>
                        <button type="file" name="file" class="layui-btn layui-btn-sm layui-btn-normal" id="file" >确定</button>
                        <button type="button" class="layui-btn layui-btn-primary layui-btn-sm" onclick="document.location='index_content';">返回</button>
                    </div>
                </div>
            </div>
        </div>
    </form>
<!-- 外框结束div -->
</div>
<script>
    layui.use('upload', function(){
        $.ajaxSetup({
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            }
        });
        var upload = layui.upload;
        upload.render({
            elem: '#test'
            ,url: 'upload_img' //改成您自己的上传接口
            ,before: function(obj){
                //预读本地文件示例，不支持ie8
                obj.preview(function(index, file, result){
                    $('#img').attr('src', result); //图片链接（base64）
                });
            }
            ,auto: false
            ,bindAction: '#file'
        });
    });
</script>
</body>
</html>
